<template>
  <el-dialog id="bouncedBox" :title="title" :visible.sync="show" :width="width" class="closeIcon" :append-to-body="append"
    :fullscreen="fullscreen" :close-on-click-modal="false" :close-on-press-escape="false" @close="close">
    <!-- <i class="el-icon-full-screen" @click="fullScreen" /> -->
    <slot />
    <div class="submit-btn" v-if="footer" slot="footer">
      <el-button @click="handleClose">{{ $t('取消') }}</el-button>
      <el-button type="primary" @click="handleSubmit">
        {{ $t('提交') }}
      </el-button>
    </div>
  </el-dialog>
</template>
<script>
export default {
  props: {
    title: {
      type: String,
      default: ''
    },
    dialogShow: {
      type: Boolean,
      default: false
    },
    width: {
      default: '80%'
    },
    append: {
      type: Boolean,
      default: false
    },
    footer: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      show: false,
      fullscreen: false
    }
  },
  watch: {
    dialogShow: {
      handler(val) {
        this.show = val
      },
      immediate: true
    }
  },
  methods: {
    fullScreen() {
      this.fullscreen = !this.fullscreen
    },
    handleClose() {
      this.$emit('update:dialogShow', false)
      this.$emit('cancel')
    },
    close() {
      this.$emit('update:dialogShow', false)
    },
    handleSubmit() {
      this.$emit('submit')
    }
  }
}
</script>
<style lang="scss">
#bouncedBox {
  .el-dialog__headerbtn i {
    font-size: 18px;
    font-weight: bold;
    color: var(--suq-cn-color-title);
  }

  .el-dialog {
    border-radius: 4px;
    box-shadow: 0px 2px 12px 0px rgba(0, 0, 0, 0.1);
    border: 1px solid #eeeeee;
  }

  .el-dialog__footer {
    text-align: right;
    padding-top: 6px;
  }

  .el-dialog__header {
    border-radius: 4px 4px 0 0 !important;
    padding: 16px 16px 0px 24px;
  }

  .el-dialog__title {
    font-size: 16px;
    font-family: PingFang SC;
    font-weight: 600;
    line-height: 22px;
  }

  .el-dialog__body {
    padding: 24px;
  }

  .el-form-item {
    margin-bottom: 16px;
  }
}
</style>
